
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>0.7 Acquiring Source Code for PAs · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-panel/icons.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-panel/panel.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../pa1/" />
    
    
    <link rel="prev" href="0.6.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    课程设计介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../read-before-starting.html">
            
                <a href="../read-before-starting.html">
            
                    
                    实验前必读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="./">
            
                <a href="./">
            
                    
                    PA0 - 开发环境配置
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="0.1.html">
            
                <a href="0.1.html">
            
                    
                    0.1 Installing a GNU/Linux VM
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="0.2.md">
            
                <span>
            
                    
                    0.2 First Step into Linux
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="0.3.md">
            
                <span>
            
                    
                    0.3 Installing Basic Tools
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="0.4.html">
            
                <a href="0.4.html">
            
                    
                    0.4 Installing More Tools
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="0.5.html">
            
                <a href="0.5.html">
            
                    
                    0.5 More Exploration
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="0.6.html">
            
                <a href="0.6.html">
            
                    
                    0.6 Logging in and Transferring Files via SSH
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3.7" data-path="0.7.html">
            
                <a href="0.7.html">
            
                    
                    0.7 Acquiring Source Code for PAs
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../pa1/">
            
                <a href="../pa1/">
            
                    
                    PA1 - 最简单的计算机
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../pa1/1.1.html">
            
                <a href="../pa1/1.1.html">
            
                    
                    1.1 简易调试器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../pa1/1.2.html">
            
                <a href="../pa1/1.2.html">
            
                    
                    1.2 表达式求值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../pa1/1.3.html">
            
                <a href="../pa1/1.3.html">
            
                    
                    1.3 监视点
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../pa2/">
            
                <a href="../pa2/">
            
                    
                    PA2 - 冯诺依曼计算机
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../pa2/2.1.html">
            
                <a href="../pa2/2.1.html">
            
                    
                    2.1 第一个程序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../pa2/2.2.html">
            
                <a href="../pa2/2.2.html">
            
                    
                    2.2 基本指令集
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../pa2/2.3.html">
            
                <a href="../pa2/2.3.html">
            
                    
                    2.3 输入输出
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../pa3/">
            
                <a href="../pa3/">
            
                    
                    PA3 - 异常和分页
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../pa3/3.1.html">
            
                <a href="../pa3/3.1.html">
            
                    
                    3.1 异常控制流
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../pa3/3.2.html">
            
                <a href="../pa3/3.2.html">
            
                    
                    3.2 虚拟地址空间
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../pa4/">
            
                <a href="../pa4/">
            
                    
                    PA4 - 分时多任务
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../pa4/4.1.html">
            
                <a href="../pa4/4.1.html">
            
                    
                    4.1 上下文切换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../pa4/4.2.html">
            
                <a href="../pa4/4.2.html">
            
                    
                    4.2 时钟中断
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../lab3.html">
            
                <a href="../lab3.html">
            
                    
                    Lab3 - Cachesim
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../问题汇总/">
            
                <a href="../问题汇总/">
            
                    
                    问题汇总
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../问题汇总/PA0.html">
            
                <a href="../问题汇总/PA0.html">
            
                    
                    PA0
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../问题汇总/PA1.html">
            
                <a href="../问题汇总/PA1.html">
            
                    
                    PA1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" data-path="../问题汇总/PA2.html">
            
                <a href="../问题汇总/PA2.html">
            
                    
                    PA2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4" data-path="../问题汇总/PA3.html">
            
                <a href="../问题汇总/PA3.html">
            
                    
                    PA3
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" >
            
                <span>
            
                    
                    评分细则
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="ScoringRule0.html">
            
                <a href="ScoringRule0.html">
            
                    
                    PA0评分细则
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../pa1/ScoringRule1.1.html">
            
                <a href="../pa1/ScoringRule1.1.html">
            
                    
                    PA1.1评分细则
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" data-path="../pa1/ScoringRule1.2&1.3.html">
            
                <a href="../pa1/ScoringRule1.2&1.3.html">
            
                    
                    PA1.2&1.3评分细则
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.4" data-path="../pa2/ScoringRule2.1.html">
            
                <a href="../pa2/ScoringRule2.1.html">
            
                    
                    PA2.1评分细则
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.5" data-path="../pa2/ScoringRule2.2&2.3.html">
            
                <a href="../pa2/ScoringRule2.2&2.3.html">
            
                    
                    PA2.2&2.3评分细则
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.6" data-path="../pa3/ScoringRule3.1.html">
            
                <a href="../pa3/ScoringRule3.1.html">
            
                    
                    PA3.1评分细则
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.7" data-path="../pa3/ScoringRule3.2.html">
            
                <a href="../pa3/ScoringRule3.2.html">
            
                    
                    PA3.2评分细则
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../others/">
            
                <a href="../others/">
            
                    
                    杂项
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../others/submit-requirement.html">
            
                <a href="../others/submit-requirement.html">
            
                    
                    实验提交要求
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" data-path="../others/git-manual.html">
            
                <a href="../others/git-manual.html">
            
                    
                    Git 入门教程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.3" data-path="../others/linux-manual.html">
            
                <a href="../others/linux-manual.html">
            
                    
                    Linux 入门教程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.4" data-path="../others/man-manual.html">
            
                <a href="../others/man-manual.html">
            
                    
                    Man 入门教程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.5" data-path="../others/markdown-manual.md">
            
                <span>
            
                    
                    Markdown 入门教程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.6" data-path="../others/instruction-example.html">
            
                <a href="../others/instruction-example.html">
            
                    
                    指令执行示例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.7" data-path="../others/how-to-read-i386.html">
            
                <a href="../others/how-to-read-i386.html">
            
                    
                    i386 手册阅读指南
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.8" data-path="../others/i386-typo.html">
            
                <a href="../others/i386-typo.html">
            
                    
                    i386 手册勘误
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.9" data-path="../others/software-suggest.html">
            
                <a href="../others/software-suggest.html">
            
                    
                    软件推荐
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >0.7 Acquiring Source Code for PAs</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="acquiring-source-code-for-pas">Acquiring Source Code for PAs</h1>
<p><div class="panel panel-info"><div class="panel-heading"><div class="panel-icon"><i class="icon-info"></i></div><div class="panel-title">What you should do in this section</div></div><div class="panel-content"><ol>
<li>Read the whole text carefully.</li>
<li>Try the commands of Linux mentioned.</li>
<li>Try to use commands about <code>git</code>.</li>
<li>Get the main project and initialize with your own infomation.</li>
<li>Upload the project to private on-line coding repositories.</li>
</ol>
</div></div></p>
<p>Now it&apos;s time to get ready for the trip to the simulated world of computer and this section will lead you to the entrance of it.</p>
<h2 id="getting-source-code-for-pas">Getting Source Code for PAs</h2>
<p>Go back to the home directory by</p>
<pre><code>cd ~
</code></pre><p>Usually, all works unrelated to system should be performed under the home directory. Other directories under the root of file system (<code>/</code>) are related to system. Therefore, do NOT finish your PAs and Labs under these directories by <code>sudo</code>.</p>
<p><div class="panel panel-danger"><div class="panel-heading"><div class="panel-icon"><i class="icon-danger"></i></div><div class="panel-title">&#x4E0D;&#x8981;&#x4F7F;&#x7528; root &#x8D26;&#x6237;&#x505A;&#x5B9E;&#x9A8C;&#xFF01;&#xFF01;&#xFF01;</div></div><div class="panel-content"><p>&#x4ECE;&#x73B0;&#x5728;&#x5F00;&#x59CB;, &#x6240;&#x6709;&#x4E0E;&#x7CFB;&#x7EDF;&#x76F8;&#x5173;&#x7684;&#x914D;&#x7F6E;&#x5DE5;&#x4F5C;&#x5DF2;&#x7ECF;&#x5168;&#x90E8;&#x5B8C;&#x6210;, &#x4F60;&#x5DF2;&#x7ECF;&#x6CA1;&#x6709;&#x4F7F;&#x7528;root&#x8D26;&#x6237;&#x7684;&#x5FC5;&#x8981;. &#x7EE7;&#x7EED;&#x4F7F;&#x7528;root&#x8D26;&#x6237;&#x8FDB;&#x884C;&#x5B9E;&#x9A8C;, &#x4F1A;&#x6539;&#x53D8;&#x5B9E;&#x9A8C;&#x76F8;&#x5173;&#x6587;&#x4EF6;&#x7684;&#x6743;&#x9650;&#x5C5E;&#x6027;, &#x53EF;&#x80FD;&#x4F1A;&#x5BFC;&#x81F4;&#x5F00;&#x53D1;&#x8DDF;&#x8E2A;&#x7CFB;&#x7EDF;&#x65E0;&#x6CD5;&#x6B63;&#x5E38;&#x5DE5;&#x4F5C;; &#x66F4;&#x4E25;&#x91CD;&#x7684;, &#x4F60;&#x7684;&#x8BEF;&#x64CD;&#x4F5C;&#x53EF;&#x80FD;&#x4F1A;&#x65E0;&#x610F;&#x4E2D;&#x635F;&#x574F;&#x7CFB;&#x7EDF;&#x6587;&#x4EF6;, &#x5BFC;&#x81F4;&#x865A;&#x62DF;&#x673A;&#x65E0;&#x6CD5;&#x542F;&#x52A8;! &#x5F80;&#x5C4A;&#x6709;&#x82E5;&#x5E72;&#x5B66;&#x957F;&#x56E0;&#x6B64;&#x800C;&#x5F71;&#x54CD;&#x4E86;&#x5B9E;&#x9A8C;&#x8FDB;&#x5EA6;, &#x751A;&#x81F3;&#x7531;&#x4E8E;&#x635F;&#x574F;&#x4E86;&#x5B9E;&#x9A8C;&#x76F8;&#x5173;&#x7684;&#x6587;&#x4EF6;&#x800C;&#x5F71;&#x54CD;&#x4E86;&#x5206;&#x6570;. &#x8BF7;&#x5927;&#x5BB6;&#x5F15;&#x4EE5;&#x4E3A;&#x9274;, &#x4E0D;&#x8981;&#x8D2A;&#x56FE;&#x65B9;&#x4FBF;, &#x5426;&#x5219;&#x540E;&#x679C;&#x81EA;&#x8D1F;!</p>
<p>&#x5982;&#x679C;&#x4F60;&#x4ECD;&#x7136;&#x4E0D;&#x7406;&#x89E3;&#x4E3A;&#x4EC0;&#x4E48;&#x8981;&#x8FD9;&#x6837;&#x505A;, &#x4F60;&#x53EF;&#x4EE5;&#x9605;&#x8BFB;&#x8FD9;&#x4E2A;&#x9875;&#x9762;: <a href="http://askubuntu.com/questions/16178/why-is-it-bad-to-login-as-root" target="_blank">Why is it bad to login as root?</a> &#x6B63;&#x786E;&#x7684;&#x505A;&#x6CD5;&#x662F;: &#x6C38;&#x8FDC;&#x4F7F;&#x7528;&#x4F60;&#x7684;&#x666E;&#x901A;&#x8D26;&#x53F7;&#x505A;&#x90A3;&#x4E9B;&#x5B89;&#x5206;&#x5B88;&#x5DF1;&#x7684;&#x4E8B;&#x60C5;(&#x4F8B;&#x5982;&#x5199;&#x4EE3;&#x7801;), &#x5F53;&#x4F60;&#x9700;&#x8981;&#x8FDB;&#x884C;&#x4E00;&#x4E9B;&#x9700;&#x8981;root&#x6743;&#x9650;&#x624D;&#x80FD;&#x8FDB;&#x884C;&#x7684;&#x64CD;&#x4F5C;&#x65F6;, &#x4F7F;&#x7528;<code>sudo</code>.</p>
</div></div></p>
<p>Now acquire source code for PA by the following command:</p>
<pre><code class="lang-bash">git <span class="hljs-built_in">clone</span> https://gitee.com/nuaa-pa-2021/ics-pa.git ics2022
</code></pre>
<p>A directory called <code>ics2022</code> will be created. This is the project directory for PAs. Details will be explained in PA1.</p>
<p>Issue the following commands to perform <code>git</code> configuration:</p>
<pre><code>git config --global user.name &quot;161220000-Zhang San&quot; # your student ID and name
git config --global user.email &quot;zhangsan@foo.com&quot;   # your email
git config --global core.editor vim                 # your favorite editor
git config --global color.ui true
</code></pre><p>You should configure <code>git</code> with your student ID, name, and email. Before continuing, please read <a href="../others/git-manual.html">this</a> <code>git</code> tutorial to learn some basics of <code>git</code>.</p>
<p>Enter the project directory <code>ics2022</code>, then run</p>
<pre><code>git branch -m master
bash init.sh
</code></pre><p>to add some environment variables into the bash configuration file <code>~/.bashrc</code>. These variables are defined by absolute path to support the compilation of the subprojects. Therefore, DO NOT move your project to another directory once the initialization finishes, else these variables will become invalid. Particularly, if you use shell other than <code>bash</code>, please set these variables in the corresponding configuration file manually.</p>
<h3 id="git-usage">Git Usage</h3>
<p>There is a official documentation for Git: <a href="https://git-scm.com/book/en/v2" target="_blank">https://git-scm.com/book/en/v2</a> . You can learn it whenever you have problems using git.</p>
<p>We will use the <code>branch</code> feature of <code>git</code> to manage the process of development. A branch is an ordered list of commits, where a commit refers to some modifications in the project.</p>
<p>You can list all branches by</p>
<pre><code>git branch
</code></pre><p>You will see there is only one branch called &quot;master&quot; now.</p>
<pre><code>* master
</code></pre><p>To create a new branch, use <code>git checkout</code> command:</p>
<pre><code>git checkout -b pa0
</code></pre><p>This command will create a branch called <code>pa0</code>, and check out to it. Now list all branches again, and you will see we are now at branch <code>pa0</code>:</p>
<pre><code>  master
* pa0
</code></pre><p>From now on, all modifications of files in the project will be recorded in the branch <code>pa0</code>.</p>
<p><div class="panel panel-success"><div class="panel-heading"><div class="panel-icon"><i class="icon-success"></i></div><div class="panel-title">have a try!</div></div><div class="panel-content"><p>Now  Modify the <code>STU_ID</code> variable in <code>nemu/Makefile.git</code>:</p>
<pre><code>STU_ID=161220000            # your student ID
</code></pre><p>Run</p>
<pre><code>git status
</code></pre><p>to see those files modified from the last commit:</p>
<pre><code>On branch pa0
Changes not staged for commit:
  (use &quot;git add &lt;file&gt;...&quot; to update what will be committed)
  (use &quot;git checkout -- &lt;file&gt;...&quot; to discard changes in working directory)

    modified:   nemu/Makefile.git

no changes added to commit (use &quot;git add&quot; and/or &quot;git commit -a&quot;)
</code></pre><p>Run</p>
<pre><code>git diff
</code></pre><p>to list modifications from the last commit:</p>
<pre><code class="lang-diff">diff --git a/nemu/Makefile.git b/nemu/Makefile.git
index c9b1708..b7b2e02 100644
<span class="hljs-comment">--- a/nemu/Makefile.git</span>
<span class="hljs-comment">+++ b/nemu/Makefile.git</span>
<span class="hljs-meta">@@ -1,4 +1,4 @@</span>
<span class="hljs-deletion">-STU_ID = 161220000</span>
<span class="hljs-addition">+STU_ID = 161221234</span>

  # DO NOT modify the following code!!!
</code></pre>
<p>You should see the <code>STU_ID</code> is modified. Now add the changes to commit by <code>git add</code>, and issue <code>git commit</code>:</p>
<pre><code>git add .
git commit
</code></pre><p>The <code>git commit</code> command will call the text editor. Type <code>modified my STU_ID</code> in the first line, and keep the remaining contents unchanged. Save and exit the editor, and this finishes a commit. Now you should see a log labeled with your student ID and name by</p>
<pre><code>git log
</code></pre></div></div></p>
<p>Now switch back to the <code>master</code> branch by</p>
<pre><code>git checkout master
</code></pre><p>Open <code>nemu/Makefile.git</code>, and you will find that <code>STU_ID</code> is still unchanged! By issuing <code>git log</code>, you will find that the commit log you just created has disappeared!</p>
<p>Don&apos;t worry! This is a feature of branches in <code>git</code>. Modifications in different branches are isolated, which means modifying files in one branch will not affect other branches. Switch back to <code>pa0</code> branch by</p>
<pre><code>git checkout pa0
</code></pre><p>You will find that everything comes back! If you want to make changes in <code>pa0</code> merged to <code>master</code>, you can do that with <code>git merge</code> command.</p>
<p><div class="panel panel-danger"><div class="panel-heading"><div class="panel-icon"><i class="icon-danger"></i></div><div class="panel-title">&#x4E3A;&#x6BCF;&#x4E2A;&#x9636;&#x6BB5;&#x7684; PA &#x5EFA;&#x7ACB;&#x4E00;&#x4E2A;&#x5206;&#x652F;</div></div><div class="panel-content"><p>The workflow above shows how you will use branch in PAs:</p>
<ul>
<li>before starting a new PA, new a branch <code>pa?</code> and check out to it</li>
<li>coding in the branch <code>pa?</code> (this will introduce lot of modifications)</li>
</ul>
<p><strong>&#x4E0D;&#x8981;&#x5FD8;&#x8BB0;&#x5728;&#x6BCF;&#x4E2A;&#x9636;&#x6BB5;&#x5F00;&#x59CB;&#x65F6;&#x5EFA;&#x7ACB;&#x4E00;&#x4E2A;&#x65B0;&#x5206;&#x652F; <code>pa?</code>&#xFF0C;&#x4E0D;&#x8981;&#x628A; <code>pa?</code> &#x5408;&#x5E76;&#x5230; <code>master</code>&#xFF0C;&#x4E5F;&#x4E0D;&#x8981;&#x628A;&#x65B0;&#x9636;&#x6BB5;&#x7684; <code>pa?</code> &#x5408;&#x5E76;&#x5230;&#x4E0A;&#x4E2A;&#x9636;&#x6BB5;&#x7684;&#x5206;&#x652F; <code>pa?-1</code>&#xFF0C;&#x5426;&#x5219;&#x68C0;&#x67E5;&#x811A;&#x672C;&#x722C;&#x53D6; git log &#x65F6;&#x4F1A;&#x9519;&#x8BEF;&#x5730;&#x8BB0;&#x5F55;&#x4F60;&#x5B8C;&#x6210;&#x6BCF;&#x4E2A;&#x529F;&#x80FD;&#x70B9;&#x7684;&#x65F6;&#x95F4;&#xFF0C;&#x5BFC;&#x81F4;&#x4F60;&#x88AB;&#x5224;&#x5B9A;&#x4E3A;&#x6284;&#x88AD;&#x7B49;&#x60C5;&#x51B5;&#xFF01;&#xFF01;&#xFF01;</strong></p>
</div></div></p>
<h3 id="compiling-and-running-nemu">Compiling and Running NEMU</h3>
<p>Now enter <code>nemu/</code> directory, and compile the project by <code>make</code>:</p>
<pre><code>make
</code></pre><p>If nothing goes wrong, NEMU will be compiled successfully.</p>
<p><div class="panel panel-success"><div class="panel-heading"><div class="panel-icon"><i class="icon-success"></i></div><div class="panel-title">What happened?</div></div><div class="panel-content"><p>You should know how a program is generated in the &#x7A0B;&#x5E8F;&#x8BBE;&#x8BA1;&#x57FA;&#x7840; course. But do you have any idea about what happened when a bunch of information is output to the screen during <code>make</code> is executed?</p>
</div></div></p>
<p>To perform a fresh compilation, type</p>
<pre><code>make clean
</code></pre><p>to remove the old compilation result, then <code>make</code> again.</p>
<p>To run NEMU, type</p>
<pre><code>make run
</code></pre><p>However, you will see an error message:</p>
<pre><code>nemu: nemu/src/cpu/reg.c:21: reg_test: Assertion `(cpu.gpr[check_reg_index(i)]._16) == (sample[i] &amp; 0xffff)&apos; failed.
</code></pre><p>This message tells you that the program has triggered an assertion fail at line 21 of the file <code>nemu/src/cpu/reg.c</code>. If you do not know what is assertion, blame the &#x7A0B;&#x5E8F;&#x8BBE;&#x8BA1;&#x57FA;&#x7840; course. If you go to see the line 21 of <code>nemu/src/cpu/reg.c</code>, you will discover the failure is in a test function. This failure is expected, because you have not implemented the register structure correctly. Just ignore it now, and you will fix it in PA1.</p>
<p>To debug NEMU with gdb, type</p>
<pre><code>make gdb
</code></pre><h3 id="development-tracing">Development Tracing</h3>
<p>Once the compilation succeeds, the change of source code will be traced by <code>git</code>. Type</p>
<pre><code>git log
</code></pre><p>If you see something like</p>
<pre><code>commit 4072d39e5b6c6b6837077f2d673cb0b5014e6ef9
Author: tracer-ics2017 &lt;tracer@njuics.org&gt;
Date:   Sun Jul 26 14:30:31 2017 +0800

    &gt; compile NEMU
    161220000
    user
    Linux debian 3.16.0-4-686-pae #1 SMP Debian 3.16.7-3 i686 GNU/Linux
     14:30:31 up  3:44,  2 users,  load average: 0.28, 0.09, 0.07
    3860572d5cc66412bf85332837c381c5c8c1009f
</code></pre><p>this means the change is traced successfully.</p>
<p>If you see the following message while executing make, this means the tracing fails.</p>
<pre><code>fatal: Unable to create &apos;/home/user/ics2020/.git/index.lock&apos;: File exists.

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
</code></pre><p>Try to clean the compilation result and compile again:</p>
<pre><code>make clean
make
</code></pre><p>If the error message above always appears, please contact us as soon as possible.</p>
<p><div class="panel panel-danger"><div class="panel-heading"><div class="panel-icon"><i class="icon-danger"></i></div><div class="panel-title">&#x5F00;&#x53D1;&#x8DDF;&#x8E2A;</div></div><div class="panel-content"><p>&#x6211;&#x4EEC;&#x4F7F;&#x7528; <code>git</code> &#x5BF9;&#x4F60;&#x7684;&#x5B9E;&#x9A8C;&#x8FC7;&#x7A0B;&#x8FDB;&#x884C;&#x8DDF;&#x8E2A;, &#x4E0D;&#x5408;&#x7406;&#x7684;&#x8DDF;&#x8E2A;&#x8BB0;&#x5F55;&#x4F1A;&#x5F71;&#x54CD;&#x4F60;&#x7684;&#x6210;&#x7EE9;. &#x5F80;&#x5C4A;&#x6709;&#x5B66;&#x957F;&quot;&#x5B8C;&#x6210;&quot;&#x4E86;&#x67D0;&#x90E8;&#x5206;&#x5B9E;&#x9A8C;&#x5185;&#x5BB9;, &#x4F46;&#x6211;&#x4EEC;&#x627E;&#x4E0D;&#x5230;&#x76F8;&#x5E94;&#x7684; git log, &#x6700;&#x7EC8;&#x8BE5;&#x90E8;&#x5206;&#x5185;&#x5BB9;&#x88AB;&#x89C6;&#x4E3A;&#x6CA1;&#x6709;&#x5B8C;&#x6210;. git log &#x662F;&#x72EC;&#x7ACB;&#x5B8C;&#x6210;&#x5B9E;&#x9A8C;&#x7684;&#x6700;&#x6709;&#x529B;&#x8BC1;&#x636E;, &#x5B8C;&#x6210;&#x4E86;&#x5B9E;&#x9A8C;&#x5185;&#x5BB9;&#x5374;&#x7F3A;&#x5C11;&#x5408;&#x7406;&#x7684; git log, &#x4E0D;&#x4EC5;&#x4F1A;&#x635F;&#x5931;&#x5927;&#x91CF;&#x5206;&#x6570;, &#x8FD8;&#x4F1A;&#x7ED9;&#x6284;&#x88AD;&#x5224;&#x5B9A;&#x63D0;&#x4F9B;&#x6700;&#x6709;&#x529B;&#x7684;&#x8BC1;&#x636E;. &#x56E0;&#x6B64;, &#x8BF7;&#x4F60;&#x6CE8;&#x610F;&#x4EE5;&#x4E0B;&#x4E8B;&#x9879;:</p>
<ul>
<li>&#x8BF7;&#x4F60;&#x4E0D;&#x5B9A;&#x671F;&#x67E5;&#x770B;&#x81EA;&#x5DF1;&#x7684; git log, &#x68C0;&#x67E5;&#x662F;&#x5426;&#x4E0E;&#x81EA;&#x5DF1;&#x7684;&#x5F00;&#x53D1;&#x8FC7;&#x7A0B;&#x76F8;&#x7B26;.</li>
<li>&#x63D0;&#x4EA4;&#x5F80;&#x5C4A;&#x4EE3;&#x7801;&#x5C06;&#x88AB;&#x89C6;&#x4E3A;&#x6CA1;&#x6709;&#x63D0;&#x4EA4;.</li>
<li>&#x4E0D;&#x8981;&#x628A;&#x4F60;&#x7684;&#x4EE3;&#x7801;&#x4E0A;&#x4F20;&#x5230;&#x516C;&#x5F00;&#x7684;&#x5730;&#x65B9;.</li>
<li>&#x603B;&#x662F;&#x5728;&#x5DE5;&#x7A0B;&#x76EE;&#x5F55;&#x4E0B;&#x8FDB;&#x884C;&#x5F00;&#x53D1;, &#x4E0D;&#x8981;&#x5728;&#x5176;&#x5B83;&#x5730;&#x65B9;&#x8FDB;&#x884C;&#x5F00;&#x53D1;, &#x7136;&#x540E;&#x4E00;&#x6B21;&#x6027;&#x5C06;&#x4EE3;&#x7801;&#x590D;&#x5236;&#x5230;&#x5DE5;&#x7A0B;&#x76EE;&#x5F55;&#x4E0B;, &#x8FD9;&#x6837; <code>git</code> &#x5C06;&#x4E0D;&#x80FD;&#x6B63;&#x786E;&#x8BB0;&#x5F55;&#x4F60;&#x7684;&#x5F00;&#x53D1;&#x8FC7;&#x7A0B;.</li>
<li>&#x4E0D;&#x8981;&#x4FEE;&#x6539; <code>Makefile</code> &#x4E2D;&#x4E0E;&#x5F00;&#x53D1;&#x8DDF;&#x8E2A;&#x76F8;&#x5173;&#x7684;&#x5185;&#x5BB9;.</li>
<li>&#x4E0D;&#x8981;&#x5220;&#x9664;&#x6211;&#x4EEC;&#x8981;&#x6C42;&#x521B;&#x5EFA;&#x7684;&#x5206;&#x652F;, &#x5426;&#x5219;&#x4F1A;&#x5F71;&#x54CD;&#x6211;&#x4EEC;&#x7684;&#x811A;&#x672C;&#x8FD0;&#x884C;, &#x4ECE;&#x800C;&#x5F71;&#x54CD;&#x4F60;&#x7684;&#x6210;&#x7EE9;</li>
<li>&#x4E0D;&#x8981;&#x6E05;&#x9664; git log</li>
<li>&#x4E0D;&#x8981;&#x5C1D;&#x8BD5;&#x7528;&#x811A;&#x672C;&#x5237; git log&#xFF0C;&#x8981;&#x53D1;&#x73B0;&#x5B83;&#x4EEC;&#x8FD8;&#x662F;&#x5F88;&#x5BB9;&#x6613;&#x7684;&#xFF0C;&#x53EA;&#x8981;&#x662F;&#x6B63;&#x5E38;&#x5B9E;&#x9A8C;&#x7684; git log &#x90FD;&#x4E0D;&#x4F1A;&#x88AB;&#x8BEF;&#x5224;</li>
</ul>
<p>&#x5076;&#x7136;&#x7684;&#x8DDF;&#x8E2A;&#x5931;&#x8D25;&#x4E0D;&#x4F1A;&#x5F71;&#x54CD;&#x4F60;&#x7684;&#x6210;&#x7EE9;. &#x5982;&#x679C;&#x4E0A;&#x6587;&#x4E2D;&#x7684;&#x9519;&#x8BEF;&#x4FE1;&#x606F;&#x603B;&#x662F;&#x51FA;&#x73B0;, &#x8BF7;&#x5C3D;&#x5FEB;&#x8054;&#x7CFB;&#x6211;&#x4EEC;. <strong>&#x7531;&#x4E8E;&#x68C0;&#x67E5;&#x5DE5;&#x4F5C;&#x91CF;&#x5E9E;&#x5927;&#xFF0C;&#x4E00;&#x5207;&#x68C0;&#x67E5;&#x5747;&#x4F7F;&#x7528;&#x811A;&#x672C;&#x8FDB;&#x884C;&#xFF0C;&#x4E0D;&#x7B26;&#x5408;&#x8BB2;&#x4E49;&#x8981;&#x6C42;&#x5C06;&#x51FA;&#x73B0;&#x9519;&#x8BEF;&#xFF0C;&#x82E5;&#x811A;&#x672C;&#x7B5B;&#x9009;&#x51FA;&#x5F02;&#x5E38;&#x7684; git log&#xFF0C;&#x5C06;&#x8FDB;&#x884C;&#x4EBA;&#x5DE5;&#x4E8C;&#x6B21;&#x7B5B;&#x67E5;&#xFF0C;&#x8BF7;&#x52A1;&#x5FC5;&#x91CD;&#x89C6;&#x81EA;&#x5DF1;&#x7684;&#x4EE3;&#x7801;&#xFF01;</strong></p>
</div></div></p>
<h3 id="local-commit">Local Commit</h3>
<p>Although the development tracing system will trace the change of your code after every successful compilation, the trace record is not suitable for your development. This is because the code is still buggy at most of the time. Also, it is not easy for you to identify those bug-free traces. Therefore, you should trace your bug-free code manually.</p>
<p>When you want to commit the change, type</p>
<pre><code>git add .
git commit --allow-empty
</code></pre><p>The <code>--allow-empty</code> option is necessary, because usually the change is already committed by development tracing system. Without this option, <code>git</code> will reject no-change commits. If the commit succeeds, you can see a log labeled with your student ID and name by</p>
<pre><code>git log
</code></pre><p>To filter out the commit logs corresponding to your manual commit, use <code>--author</code> option with <code>git log</code>. For details of how to use this option, RTFM.</p>
<h3 id="submission">Submission</h3>
<p>Finally, you should submit your project to the submission website.</p>
<pre><code>ics2022
&#x251C;&#x2500;&#x2500; init.sh
&#x251C;&#x2500;&#x2500; Makefile
&#x251C;&#x2500;&#x2500; nanos-lite
&#x251C;&#x2500;&#x2500; navy-apps
&#x251C;&#x2500;&#x2500; nemu
&#x2514;&#x2500;&#x2500; nexus-am
</code></pre><p>Then go back to the project directory, issue</p>
<pre><code>make submit
</code></pre><p>This command does 3 things:</p>
<ol>
<li>Cleanup unnecessary files for submission</li>
<li>Cleanup unnecessary files in git</li>
<li>Create an archive containing the source code and your report. <strong>The archive is located in the father directory of the project directory, and it is named by your student ID set in Makefile.</strong></li>
</ol>
<p>If nothing goes wrong, transfer the archive to your host. Open the archive to double check whether everything is fine. And you can manually submit this archive to the submission website.</p>
<h2 id="uploading-codes-to-repositories">Uploading Codes to Repositories</h2>
<p>It&apos;s dangerous to save the only copy of your codes in the VM for the possibility of loss the code so you are asked to upload your project onto on-line code repositories. <strong>Make sure you have set the accessibility of your project as <code>PRIVATE</code> so that nobody except you can get the access to your codes to protect  them.</strong> Giving your codes to others is not wise because we don&apos;t know who treated so both of you will be judged treated.</p>
<p><div class="panel panel-danger"><div class="panel-heading"><div class="panel-icon"><i class="icon-danger"></i></div><div class="panel-title">&#x4E0A;&#x4F20;&#x4EE3;&#x7801;&#x5230;&#x5728;&#x7EBF;&#x4EE3;&#x7801;&#x4ED3;&#x5E93;&#x5E76;&#x8BBE;&#x7F6E;&#x79C1;&#x6709;</div></div><div class="panel-content"><p>&#x4E0D;&#x8981;&#x4EC5;&#x4EC5;&#x628A;&#x4F60;&#x7684;&#x4EE3;&#x7801;&#x53EA;&#x5728;&#x865A;&#x62DF;&#x673A;&#x91CC;&#x5B58;&#x4E00;&#x4EFD;&#xFF0C;&#x8FD9;&#x5F88;&#x5371;&#x9669;&#x3002;&#x6BCF;&#x5E74;&#x90FD;&#x6709;&#x5B66;&#x957F;&#x5B66;&#x59D0;&#x56E0;&#x540E;&#x671F;&#x865A;&#x62DF;&#x673A;&#x7A81;&#x7136;&#x6545;&#x969C;&#x800C;&#x4E22;&#x5931;&#x4E86;&#x5B9D;&#x8D35;&#x7684;&#x4EE3;&#x7801;&#xFF0C;&#x9762;&#x5BF9;&#x6210;&#x7EE9;&#x53EA;&#x80FD;&#x6D41;&#x4E0B;&#x4E86;&#x6094;&#x6068;&#x7684;&#x6CEA;&#x6C34;&#x3002;&#x9274;&#x4E8E;&#x6B64;&#xFF0C;&#x6211;&#x4EEC;&#x8981;&#x6C42;&#x672C;&#x5B66;&#x671F;&#x6240;&#x6709;&#x540C;&#x5B66;&#x90FD;&#x5FC5;&#x987B;&#x5728;&#x5728;&#x7EBF;&#x4EE3;&#x7801;&#x5E73;&#x53F0;<strong>&#x79C1;&#x6709;</strong>&#x6258;&#x7BA1;&#x81EA;&#x5DF1;&#x7684;&#x9879;&#x76EE;&#x3002;&#x56FD;&#x5185;&#x53EF;&#x7528;&#x7684;&#x53EF;&#x4EE5;&#x514D;&#x8D39;&#x5EFA;&#x7ACB;&#x79C1;&#x6709;&#x6258;&#x7BA1;&#x4ED3;&#x5E93;&#x7684;&#x5E73;&#x53F0;&#x6709;&#x5982;&#x4E0B;&#x51E0;&#x5BB6;&#xFF1A;</p>
<ul>
<li>GitHub (<a href="https://github.com/" target="_blank">https://github.com/</a>) &#xFF08;GitHub &#x5DF2;&#x7ECF;&#x5141;&#x8BB8;&#x514D;&#x8D39;&#x7528;&#x6237;&#x5EFA;&#x7ACB;&#x79C1;&#x6709;&#x4ED3;&#x5E93;&#xFF09;</li>
<li>Coding.net (<a href="https://coding.net/" target="_blank">https://coding.net/</a>)</li>
<li>&#x7801;&#x4E91; (<a href="https://gitee.com/" target="_blank">https://gitee.com/</a>)</li>
</ul>
<p>&#x8BF7;&#x4F60;&#x81EA;&#x884C;&#x4EFB;&#x610F;&#x9009;&#x62E9;&#x4E00;&#x4E2A;&#x5E73;&#x53F0;&#x5E76;&#x6CE8;&#x518C;&#xFF0C;&#x5C06;&#x4EE3;&#x7801;&#x4E0A;&#x4F20;&#x6258;&#x7BA1;&#xFF0C;&#x5E76;&#x8BBE;&#x7F6E;&#x4E3A;&#x79C1;&#x6709;&#x9879;&#x76EE;&#x3002;</p>
</div></div></p>
<p><div class="panel panel-danger"><div class="panel-heading"><div class="panel-icon"><i class="icon-danger"></i></div><div class="panel-title">&#x52A1;&#x5FC5;&#x4FDD;&#x7BA1;&#x597D;&#x81EA;&#x5DF1;&#x7684;&#x4EE3;&#x7801;</div></div><div class="panel-content"><p>&#x540E;&#x53F0;&#x4F7F;&#x7528;&#x4E86;&#x4EE3;&#x7801;&#x67E5;&#x91CD;&#x5DE5;&#x5177;&#xFF0C;&#x6BCF;&#x6B21;&#x63D0;&#x4EA4;&#x673A;&#x5668;&#x67E5;&#x91CD; 100%&#xFF0C;&#x5E76;&#x62BD;&#x53D6; 20% &#x8FDB;&#x884C;&#x4EBA;&#x5DE5;&#x67E5;&#x91CD;&#x3002;&#x67E5;&#x91CD;&#x672C;&#x7740;&#x5B81;&#x613F;&#x653E;&#x8FC7;&#x4E5F;&#x4E0D;&#x4F1A;&#x8BEF;&#x6740;&#x7684;&#x539F;&#x5219;&#x8FDB;&#x884C;&#x3002;&#x5982;&#x679C;&#x4F60;&#x628A;&#x4EE3;&#x7801;&#x53D1;&#x7ED9;&#x4ED6;&#x4EBA;&#xFF08;&#x6216;&#x56E0;&#x6CA1;&#x6709;&#x8BBE;&#x5B9A;&#x79C1;&#x6709;&#x9879;&#x76EE;&#x4FDD;&#x7BA1;&#x4E0D;&#x5584;&#xFF0C;&#x751A;&#x81F3;&#x88AB;&#x4ED6;&#x4EBA;&#x4EE5;&#x67D0;&#x79CD;&#x65B9;&#x5F0F;&#x7A83;&#x53D6;&#xFF09;&#x56E0;&#x6B64;&#x88AB;&#x5224;&#x5B9A;&#x6284;&#x88AD;&#xFF0C;&#x65E0;&#x8BBA;&#x5904;&#x4E8E;&#x4F55;&#x79CD;&#x4E3B;&#x89C2;&#x6216;&#x5BA2;&#x89C2;&#x7684;&#x539F;&#x56E0;&#xFF0C;<strong>&#x6211;&#x4EEC;&#x4E0D;&#x4F1A;&#x5224;&#x65AD;&#x662F;&#x8C01;&#x6284;&#x88AD;&#x8C01;&#xFF0C;&#x56E0;&#x6B64;&#x5C06;&#x8FDB;&#x884C;&#x5404;&#x6253;&#x4E94;&#x5341;&#x5927;&#x677F;&#x7684;&#x5904;&#x7406;&#xFF0C;&#x56E0;&#x6B64;&#x8BF7;&#x52A1;&#x5FC5;&#x4FDD;&#x7BA1;&#x597D;&#x81EA;&#x5DF1;&#x7684;&#x4EE3;&#x7801;&#x3002;</strong></p>
</div></div></p>
<p>To push your codes to a new remote address, you should create a new remote point named <code>myrepo</code> instead of using <code>origin</code> because we will often tell you to <code>pull</code> new updates from the remote point <code>origin</code>.</p>
<p>We presume that you have created a repository named <code>ics2022</code> on <code>Coding.net</code> and you get a address like</p>
<pre><code class="lang-url">https://git.coding.net/jinhang1997/ics2022.git
</code></pre>
<p>and this address is the target you should push your project onto. Execute commands below</p>
<pre><code class="lang-bash">git remote add myrepo https://git.coding.net/jinhang1997/ics2022.git
git push -u myrepo master
</code></pre>
<p> and everything in your project on branch <code>master</code> will be pushed onto the git server. The argument <code>-u</code> will set <code>myrepo</code> as your default remote point. Note that you cannot push changes to the <code>origin</code> branch but we will tell you to pull something new form <code>origin</code> to your working branch when we developed some new features or fixed some bugs.</p>
<p>To push other branches onto the server is the same pattern of operation like:</p>
<pre><code class="lang-bash">git push myrepo pa0
</code></pre>
<p>You should usually push your correct branch of project onto  the server to keep your code safe.</p>
<p>When we tell you that you should update your project on branch<code>paX</code>, what you should do is just</p>
<pre><code class="lang-bash">git pull origin paX
</code></pre>
<p>and the changes will be written to the paX branch then a window of vim will be allocated to ask you write something about this merge and what you should do is type <code>:wq</code> to save and exit it.</p>
<h2 id="rtfsc-and-enjoy">RTFSC and Enjoy</h2>
<p>If you are new to GNU/Linux and finish this tutorial by yourself, congratulations! You have learn a lot! The most important, you have learn searching the Internet and RTFM for using new tools and trouble-shooting. With these skills, you can solve lots of troubles by yourself during PAs, as well as in the future.</p>
<p>In PA1, the first thing you will do is to <a href="http://i.linuxtoy.org/docs/guide/ch48s06.html" target="_blank">RTFSC</a>. If you have troubles during reading the source code, go to RTFM:</p>
<ul>
<li>If you can not find the definition of a function, it is probably a library function. Read <code>man</code> for more information about that function.</li>
<li>If you can not understand the code related to hardware details, refer to the i386 manual.</li>
</ul>
<p>By the way, you will use C language for programming in all PAs. <a href="http://docs.huihoo.com/c/linux-c-programming" target="_blank">Here</a> is an excellent tutorial about C language. It contains not only C language (such as how to use <code>printf()</code> and <code>scanf()</code>), but also other elements in a computer system (data structure, computer architecture, assembly language, linking, operating system, network...). It covers most parts of this course. You are strongly recommended to read this tutorial.</p>
<p>Finally, enjoy the journey of PAs, and you will find hardware is not mysterious, so does the computer system! But remember:</p>
<ul>
<li>The machine is always right.</li>
<li>Every line of untested code is always wrong.</li>
<li>RTFM.</li>
</ul>
<p><div class="panel panel-success"><div class="panel-heading"><div class="panel-icon"><i class="icon-success"></i></div><div class="panel-title">How will you do?</div></div><div class="panel-content"><p>Von Neumann architecture (&#x51AF;&#xB7;&#x8BFA;&#x4F9D;&#x66FC;&#x4F53;&#x7CFB;) consists of these parts below:</p>
<ul>
<li>A <a href="https://en.wikipedia.org/wiki/Central_processing_unit" target="_blank">processing unit</a> that contains an <a href="https://en.wikipedia.org/wiki/Arithmetic_logic_unit" target="_blank">arithmetic logic unit</a> and <a href="https://en.wikipedia.org/wiki/Processor_register" target="_blank">processor registers</a></li>
<li>A <a href="https://en.wikipedia.org/wiki/Control_unit" target="_blank">control unit</a> that contains an <a href="https://en.wikipedia.org/wiki/Instruction_register" target="_blank">instruction register</a> and <a href="https://en.wikipedia.org/wiki/Program_counter" target="_blank">program counter</a></li>
<li><a href="https://en.wikipedia.org/wiki/Computer_memory" target="_blank">Memory</a> that stores <a href="https://en.wikipedia.org/wiki/Data_(computing" target="_blank">data</a>) and <a href="https://en.wikipedia.org/wiki/Instruction_set" target="_blank">instructions</a></li>
<li>External <a href="https://en.wikipedia.org/wiki/Mass_storage" target="_blank">mass storage</a></li>
<li><a href="https://en.wikipedia.org/wiki/Input_and_output" target="_blank">Input and output</a> mechanisms</li>
</ul>
<p>If you were asked to make a simulated computer which can run a <code>helloworld</code> program by yourself, how will you do that? This question has no correct answer and you can imagine it as you like. You can answer it in Chinese or English.</p>
</div></div></p>
<p><div class="panel panel-success"><div class="panel-heading"><div class="panel-icon"><i class="icon-success"></i></div><div class="panel-title">Reminder</div></div><div class="panel-content"><p>This ends PA0. And there is no &#x7AE0;&#x672B;&#x5FC5;&#x7B54;&#x9898; in PA0.</p>
</div></div></p>
<hr>
<p><em>That&apos;s everything in PA0.7.</em></p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="0.6.html" class="navigation navigation-prev " aria-label="Previous page: 0.6 Logging in and Transferring Files via SSH">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../pa1/" class="navigation navigation-next " aria-label="Next page: PA1 - 最简单的计算机">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"0.7 Acquiring Source Code for PAs","level":"1.3.7","depth":2,"next":{"title":"PA1 - 最简单的计算机","level":"1.4","depth":1,"path":"pa1/README.md","ref":"pa1/README.md","articles":[{"title":"1.1 简易调试器","level":"1.4.1","depth":2,"path":"pa1/1.1.md","ref":"pa1/1.1.md","articles":[]},{"title":"1.2 表达式求值","level":"1.4.2","depth":2,"path":"pa1/1.2.md","ref":"pa1/1.2.md","articles":[]},{"title":"1.3 监视点","level":"1.4.3","depth":2,"path":"pa1/1.3.md","ref":"pa1/1.3.md","articles":[]}]},"previous":{"title":"0.6 Logging in and Transferring Files via SSH","level":"1.3.6","depth":2,"path":"pa0/0.6.md","ref":"pa0/0.6.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["panel","-sharing"],"pluginsConfig":{"panel":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"pa0/0.7.md","mtime":"2022-03-11T02:15:02.537Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2022-06-05T09:31:00.205Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

